﻿using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MyOCR
{
    static class Program
    {
        public static SetUpSave _config;


        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {

            Initialization();
            string Contentjson = JsonConvert.SerializeObject(InterfaceAndLanguage.dic);
            _config = SetUpSave.Create();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }

        /// <summary>
        /// 初始化
        /// </summary>
        static void Initialization()
        {
            string jsonfile = "language.json";//JSON文件路径

            using (StreamReader file = new StreamReader(jsonfile, System.Text.Encoding.GetEncoding("gb2312")))
            {
                using (JsonTextReader reader = new JsonTextReader(file))
                {
                    JObject o = (JObject)JToken.ReadFrom(reader);
                    IList<string> s = o.Root.Select(x=>x.ToString()).ToList();
                }
            }
            
            //InterfaceAndLanguage.dic = JsonConvert.DeserializeObject(Contentjson.ToString());
            InterfaceAndLanguage.dic.Add("百度", new Dictionary<string, string>());
            InterfaceAndLanguage.dic.Add("腾讯", new Dictionary<string, string>());
            InterfaceAndLanguage.dic.Add("有道", new Dictionary<string, string>());
            InterfaceAndLanguage.dic.Add("搜狗", new Dictionary<string, string>());
            #region MyRegion
            InterfaceAndLanguage.dic["百度"].Add("中英文混合", "CHN_ENG");
            InterfaceAndLanguage.dic["百度"].Add("英文", "ENG");
            InterfaceAndLanguage.dic["百度"].Add("葡萄牙语", "POR");
            InterfaceAndLanguage.dic["百度"].Add("法语", "FRE");
            InterfaceAndLanguage.dic["百度"].Add("德语", "GER");
            InterfaceAndLanguage.dic["百度"].Add("意大利语", "ITA");
            InterfaceAndLanguage.dic["百度"].Add("西班牙语", "SPA");
            InterfaceAndLanguage.dic["百度"].Add("俄语", "RUS");
            InterfaceAndLanguage.dic["百度"].Add("日语", "JAP");
            InterfaceAndLanguage.dic["百度"].Add("韩语", "KOR");

            InterfaceAndLanguage.dic["有道"].Add("自动识别", "auto");
            InterfaceAndLanguage.dic["有道"].Add("简体中文", "zh-CHS");
            InterfaceAndLanguage.dic["有道"].Add("繁体中文", "zh-CHT");
            InterfaceAndLanguage.dic["有道"].Add("英文", "en");
            InterfaceAndLanguage.dic["有道"].Add("日文", "ja");
            InterfaceAndLanguage.dic["有道"].Add("韩文", "ko");
            InterfaceAndLanguage.dic["有道"].Add("法文", "fr");
            InterfaceAndLanguage.dic["有道"].Add("西班牙文", "es");
            InterfaceAndLanguage.dic["有道"].Add("葡萄牙文", "pt");
            InterfaceAndLanguage.dic["有道"].Add("俄文", "ru");
            InterfaceAndLanguage.dic["有道"].Add("德文", "de");
            InterfaceAndLanguage.dic["有道"].Add("意大利文", "it");
            InterfaceAndLanguage.dic["有道"].Add("印度尼西亚文", "id");
            InterfaceAndLanguage.dic["有道"].Add("罗马尼亚文", "ro");
            InterfaceAndLanguage.dic["有道"].Add("波兰文", "pl");
            InterfaceAndLanguage.dic["有道"].Add("荷兰文", "nl");
            InterfaceAndLanguage.dic["有道"].Add("挪威文", "no");
            InterfaceAndLanguage.dic["有道"].Add("丹麦文", "da");
            InterfaceAndLanguage.dic["有道"].Add("泰文", "th");
            InterfaceAndLanguage.dic["有道"].Add("印地文", "hi");
            InterfaceAndLanguage.dic["有道"].Add("拉丁文", "la");
            InterfaceAndLanguage.dic["有道"].Add("土耳其文", "tr");
            InterfaceAndLanguage.dic["有道"].Add("孟加拉文", "bn");
            InterfaceAndLanguage.dic["有道"].Add("蒙古文", "mn");
            InterfaceAndLanguage.dic["有道"].Add("尼泊尔文", "ne");
            InterfaceAndLanguage.dic["有道"].Add("马来文", "ms");
            InterfaceAndLanguage.dic["有道"].Add("阿拉伯文", "ar");

            InterfaceAndLanguage.dic["搜狗"].Add("简体中文", "zh-CHS");
            InterfaceAndLanguage.dic["搜狗"].Add("英语", "en");
            InterfaceAndLanguage.dic["搜狗"].Add("俄语", "ru");
            InterfaceAndLanguage.dic["搜狗"].Add("日语", "ja");
            InterfaceAndLanguage.dic["搜狗"].Add("法语", "fr");
            InterfaceAndLanguage.dic["搜狗"].Add("德语", "de");
            InterfaceAndLanguage.dic["搜狗"].Add("西班牙语", "es");
            InterfaceAndLanguage.dic["搜狗"].Add("葡萄牙语", "pt");

            InterfaceAndLanguage.dic["腾讯"].Add("暂无选项", "not");
            InterfaceAndLanguage.dic["腾讯"].Add("可直接识别", "not");
            #endregion
        }
    }
}
